﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using Icms.Core;
using Icms.Resources;

namespace Icms.WebUI.Controllers
{
    public class LanguageIdAjaxDropdownController : Controller
    {
        public ActionResult GetItems(Guid? key)
        {
            var list = new List<SelectListItem> { new SelectListItem { Text = Mui.not_selected, Value = "" } };

            
            list.AddRange(Const.languages.Select(o => 
                                                 new SelectListItem
                                                     {
                                                         Text = o.Value, 
                                                         Value = o.Key.ToString(), 
                                                         Selected = o.Key == key
                                                     }));
            return Json(list);
        }
    }
}